package com.java.base.classloader;

import javax.crypto.spec.DESKeySpec;

public class PrintClassLoader {
    public static void main(String[] args) throws ClassNotFoundException {
        XClassLoader classLoader = new XClassLoader();
        System.out.println(classLoader.loadClass("32323"));
    }




    public static void printClassLoadersDemo() {
        printClassLoaders(String.class, DESKeySpec.class, PrintClassLoader.class);
//        printClassLoaders(ClassLoader.getPlatformClassLoader().getClass());
        printClassLoaders(ClassLoader.getSystemClassLoader().getClass());

    }

    public static void printClassLoaders(Class<?>... cs) {
        for (Class<?> clz : cs) {
            printClassLoader(clz);
        }
    }

    public static void printClassLoader(Class<?> clz) {
        if (clz == null || clz.getClassLoader() == null) {
            System.err.println("null");
            return;
        }
        System.err.println(clz.getClassLoader().getClass().getName());
    }

}
